// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.16.10
package sys

import (
	"context"
	"hotgo/api/admin/videoorder"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	VideoOrder = cVideoOrder{}
)

type cVideoOrder struct{}

// List 查看订单管理列表
func (c *cVideoOrder) List(ctx context.Context, req *videoorder.ListReq) (res *videoorder.ListRes, err error) {
	list, totalCount, err := service.SysVideoOrder().List(ctx, &req.VideoOrderListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.VideoOrderListModel{}
	}

	res = new(videoorder.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出订单管理列表
func (c *cVideoOrder) Export(ctx context.Context, req *videoorder.ExportReq) (res *videoorder.ExportRes, err error) {
	err = service.SysVideoOrder().Export(ctx, &req.VideoOrderListInp)
	return
}

// Edit 更新订单管理
func (c *cVideoOrder) Edit(ctx context.Context, req *videoorder.EditReq) (res *videoorder.EditRes, err error) {
	err = service.SysVideoOrder().Edit(ctx, &req.VideoOrderEditInp)
	return
}

// View 获取指定订单管理信息
func (c *cVideoOrder) View(ctx context.Context, req *videoorder.ViewReq) (res *videoorder.ViewRes, err error) {
	data, err := service.SysVideoOrder().View(ctx, &req.VideoOrderViewInp)
	if err != nil {
		return
	}

	res = new(videoorder.ViewRes)
	res.VideoOrderViewModel = data
	return
}

// Delete 删除订单管理
func (c *cVideoOrder) Delete(ctx context.Context, req *videoorder.DeleteReq) (res *videoorder.DeleteRes, err error) {
	err = service.SysVideoOrder().Delete(ctx, &req.VideoOrderDeleteInp)
	return
}

// Status 更新订单管理状态
func (c *cVideoOrder) Status(ctx context.Context, req *videoorder.StatusReq) (res *videoorder.StatusRes, err error) {
	err = service.SysVideoOrder().Status(ctx, &req.VideoOrderStatusInp)
	return
}